package com.qqpz.sign_project.service.impl;

import com.qqpz.sign_project.entity.Admin;
import com.qqpz.sign_project.mappers.AdminMapper;
import com.qqpz.sign_project.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class AdminServiceImpl implements AdminService {
   @Autowired
   private AdminMapper adminMapper;
    @Override
    public Admin verifyAdmin(Admin admin) {
        return adminMapper.verifyAdmin(admin);
    }

    @Override
    public List<String> queryAllUsername() {
        return adminMapper.queryAllUsername();
    }

    @Override
    public List<Admin> queryAllAdmin() {
        return adminMapper.queryAllAdmin();
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public int createAdmin(Admin admin) {
        return adminMapper.createAdmin(admin);

    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public int updateAdmin(Admin admin) {
        return adminMapper.updateAdmin(admin);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public int updateAdminName(Admin admin) {
        return adminMapper.updateAdminName(admin);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public int deleteAdmin(String username) {
        return adminMapper.deleteAdmin(username);
    }
}
